package Util;

import java.awt.Component;
import javax.swing.JOptionPane;

/**
 *
 * @author Nguyen Hong Phu (1142066) - 11HCB (HCMUS)
 */
public class MsgUtil {
    public static void error(Component parentComponent, String msg, String title){
        JOptionPane.showMessageDialog(parentComponent,msg,title,
                    JOptionPane.ERROR_MESSAGE);
    }
    public static void error(Component parentComponent, String msg){
        JOptionPane.showMessageDialog(parentComponent,msg,"Lỗi...",
                    JOptionPane.ERROR_MESSAGE);
    }
    public static void error(String msg){
        JOptionPane.showMessageDialog(null,msg,"Lỗi...",
                    JOptionPane.ERROR_MESSAGE);
    }
    public static void error(String msg, String infoError){
        JOptionPane.showMessageDialog(null,msg+"\nThông tin lỗi: "+infoError,"Lỗi...",
                    JOptionPane.ERROR_MESSAGE);
    }
    public static int yesno(Component parentComponent, String msg, String title){
        return JOptionPane.showConfirmDialog(parentComponent,msg,title,
                JOptionPane.YES_NO_OPTION);
    }
    public static int yesno(Component parentComponent, String msg){
        return JOptionPane.showConfirmDialog(parentComponent,msg,"Hỏi...",
                JOptionPane.YES_NO_OPTION);
    }
    public static int yesno(String msg){
        return JOptionPane.showConfirmDialog(null,msg,"Hỏi...",
                JOptionPane.YES_NO_OPTION);
    }
    public static void info(Component parentComponent, String msg, String title){
         JOptionPane.showMessageDialog(parentComponent,msg,title,
                JOptionPane.INFORMATION_MESSAGE);
    }
     public static void info(Component parentComponent, String msg){
         JOptionPane.showMessageDialog(parentComponent,msg,"Thông tin...",
                JOptionPane.INFORMATION_MESSAGE);
    }
     public static void info(String msg){
         JOptionPane.showMessageDialog(null,msg,"Thông tin...",
                JOptionPane.INFORMATION_MESSAGE);
    }
}
